/*
 * @Author: fjxcjm 3157329468@qq.com
 * @Date: 2024-10-12 10:05:33
 * @LastEditors: fjxcjm 3157329468@qq.com
 * @LastEditTime: 2024-10-16 17:49:20
 * @FilePath: \vue3-project\src\utils\permission.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import router from "@/router";

export async function setRoutesByRole() {
  // 动态导入对应角色的路由配置
  const role = localStorage.getItem("userRole");
  const modules = await import(`../router/role/${role}.js`);

  // 遍历模块中的每个路由项并添加到路由实例中
  modules.default.forEach((item) => {
    router.addRoute(item);
  });

  console.log(router.getRoutes())
}
